<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>article</title>
    <style type="text/css">
        .article-main-div{
            display: block;
            margin: 0 auto;
            width: 800px;
        }
        .article-main-div>form>table{
            border-collapse:separate; 
            border-spacing:45px 100px;
        }
    </style>
    <c:set property="${pageContext.request.contextPath}" var="ctx"></c:set>
    <script src="${ctx}/static/js/jquery.min.js"></script>
</head>
<body>
<div class="article-main-div">
	<form action="${ctx}/article/save" method="post" id="article-add-form">
	    <table >
	        <tr>
	            <td>标题</td>
	            <td><input type="text" name="title" id="title" style="width:300px"></td>
	        </tr>
	        <tr>
	            <td>内容</td>
	            <td><textarea rows="8" cols="80" name="content" id="content"></textarea>
	        </tr>
	        <tr>
	            <td><button id="article-save-btn">保存</button></td>
	            <td><a href="${ctx}/article/search">百度一下</a></td>
	        </tr>
	    </table>
	</form>
</div>
</body>
<script type="text/javascript">
    $(function(){
    	var flag = true;
    	$("#article-save-btn").click(function(){
    		if("content" == "" || "title" == ""){
    			alert("MDZZ")
    		}else{
    			if(flag){
    				alert("保存成功")
	    			$("#article-add-form")[0].submit();
    			}else{
    				flag = false;
    			}    				
    		}
    	})
    })
</script>
</html>